# -*- coding: utf-8 -*-
# File : vuls_utils.py
# Author: taoyahui
# Date : 2021/6/18
import sys
sys.path.append('..')
import configparser
import os
from utils.path_util import get_root_dir
from utils import log_util
# logging.basicConfig(level=logging.INFO)

cf = configparser.ConfigParser()
cf.read(os.path.join(get_root_dir(),"config.ini"))

secs = cf.sections()
vul_dir = cf.get("vuls", "root_dir")


# 漏洞发现
def cve_detect():
    print("*" * 20 , "开始扫描包！！！！", "*" * 20)
    print("*" * 20 , "开始扫描包！！！！", "*" * 20)
    print("*" * 20 , "开始扫描包！！！！", "*" * 20)

    res = os.system(f'cd {vul_dir} && ./scan.sh')
    log_util.logger.info(f'scan result is {res}')
    print("*" * 20, "开始分析包！！！！", "*" * 20)
    print("*" * 20, "开始分析包！！！！", "*" * 20)
    print("*" * 20, "开始分析包！！！！", "*" * 20)
    res1 = os.system(f'cd {vul_dir} && ./report.sh')
    log_util.logger.info(f'report result is {res1}')


if __name__ == '__main__':
    cve_detect()